Helpful Information
 
 
Category: MySQL and other databases
"Top Two" Query - Reqd Results not showing

Just a quick one (hopefully!)

I have created the table etc in my database that are required and am just working on the queries. I need to create a query that will display the top two entries of one of my tables....as in from the table of Goalscorers (about 10 entries) i want only the top two with the most "Goals" to be shown.

I have tried a few expressions etc but am not getting the required results to show....

anyone got any ideas?

Microsoft SQL Server
SELECT TOP 2 [columns] FROM table

PostgreSQL and MySQL
SELECT [column] FROM table LIMIT 2

Oracle
SELECT column FROM table WHERE ROWNUM <= 10

You haven't mentioned which is your database but i hope this will solve your problem.

Oracle
SELECT column FROM table WHERE ROWNUM <= 1010? Oracle requires one to use binary for integer values?










privacy (GDPR)